//package com.zhang.authoritycenter.service;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.security.core.authority.SimpleGrantedAuthority;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * description
// *
// * @author zhangFanJun
// * @date 2023-12-04 17:26
// **/
//@Service
//public class UserService implements UserDetailsService {
//
//    private final Logger log = LoggerFactory.getLogger(UserDetailsService.class);
//
//    @Resource
//    private PasswordEncoder passwordEncoder;
//
//    /**
//     * 后期改造成访问鉴权中心
//     * */
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
////        PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
////        UserDetails user = User.withUsername("zhang").password(passwordEncoder.encode("123")).roles("manager").build();
////
////        return new InMemoryUserDetailsManager(user);
//
//        List<GrantedAuthority> authorities = new ArrayList<>();
//        // 用户可以访问的资源名称（或者说用户所拥有的权限） 注意：必须"ROLE_"开头
//        authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
//        // 临时写死 这里是数据库查询出来的
//        return User.builder().username(username)
//                .password(passwordEncoder.encode("123456"))
//                .authorities(authorities).build();
//
//    }
//}
